<?php

/**
 * This is the model class for table "Product_Del".
 *
 * The followings are the available columns in table 'Product_Del':
 * @property integer $prodid
 * @property string $ProductModel
 * @property string $ProductName
 * @property string $ProductDetail
 * @property string $VendorCode
 * @property string $Inventory
 * @property string $Specialty
 * @property string $SizeInch
 * @property string $Sizecm
 * @property string $WeightLB
 * @property string $WeightKG
 * @property string $WeighttoCust
 * @property double $FactoryCost
 * @property double $LACost
 * @property string $Packing
 * @property integer $PurchaseTotal
 * @property integer $SalesTotal
 * @property integer $DamagedTotal
 * @property double $AverageCost
 * @property integer $OnHand
 * @property integer $ReorderPoint
 * @property string $Comment
 * @property string $CreateTime
 * @property string $UpdateTime
 * @property string $Login
 * @property string $Modifier
 * @property double $LAAvgCost
 * @property string $PModel_2
 * @property integer $UsedTotal
 * @property integer $OnHold
 * @property integer $Available
 * @property integer $ShipTotal
 * @property integer $LentTotal
 * @property string $Currency
 * @property string $ECategory
 * @property string $CCategory
 * @property string $ESCategory
 * @property string $CSCategory
 * @property string $Type
 * @property string $Div
 * @property string $SubDiv
 * @property string $NIDNo
 * @property double $Amazon_S
 * @property double $Ebay_S
 * @property string $Class
 * @property string $Rank
 * @property integer $OnShipping
 * @property integer $TurnaroundTime
 * @property double $TurTimeCoefficient
 * @property integer $Re_weekNo
 * @property integer $Qu_Day
 * @property integer $Qu_3Days
 * @property integer $Qu_Current
 * @property integer $Qu_4Weeks
 * @property integer $Qu_12Weeks
 * @property integer $Qu_Past
 * @property integer $Re_pieceNo
 * @property integer $OHWeekNo
 * @property double $Ivnt_Value
 * @property integer $ExceedingNo
 * @property double $Eprofit
 * @property double $AverageProfit
 * @property double $ASC
 * @property double $ProfitReRate
 * @property integer $SalesWeek
 * @property integer $LAN
 * @property double $Lot_SC
 * @property double $LAN_SC
 * @property double $LSA
 * @property string $Lot_Cmnts
 * @property string $NIP_Photo
 * @property string $NIP_Desc
 * @property string $NIP_Keyword
 * @property string $NIP_InstructionManu
 * @property string $NIP_Software
 * @property string $Package
 * @property string $Holiday
 * @property string $Event
 * @property string $Promotion
 * @property integer $ListingNo
 * @property string $Lot_Ready
 * @property string $Listing_Ready
 * @property string $Description
 * @property double $Amazon_P
 * @property double $eBayFS
 * @property double $Buy
 * @property double $Offer
 * @property double $Bid
 * @property string $Lot
 * @property double $Lot1_Amazon
 * @property double $Lot2_Amazon
 * @property double $Lot3_Amazon
 * @property double $Lot4_Amazon
 * @property double $Commission
 * @property string $QStatus
 * @property string $Purchased
 * @property string $Listing_Des
 * @property string $RCMDPerson
 * @property double $Lot1_Ebay
 * @property double $Lot2_Ebay
 * @property double $Lot3_Ebay
 * @property double $Lot4_Ebay
 * @property string $Flup_P
 * @property string $OF1
 * @property string $OF2
 * @property integer $ProductID
 * @property string $DelTime
 */
class ProductDel extends CActiveRecord {

    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return ProductDel the static model class
     */
    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'Product_Del';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('PurchaseTotal, SalesTotal, DamagedTotal, OnHand, ReorderPoint, UsedTotal, OnHold, Available, ShipTotal, LentTotal, OnShipping, TurnaroundTime, Re_weekNo, Qu_Day, Qu_3Days, Qu_Current, Qu_4Weeks, Qu_12Weeks, Qu_Past, Re_pieceNo, OHWeekNo, ExceedingNo, SalesWeek, LAN, ListingNo, ProductID', 'numerical', 'integerOnly' => true),
            array('FactoryCost, LACost, AverageCost, LAAvgCost, Amazon_S, Ebay_S, TurTimeCoefficient, Ivnt_Value, Eprofit, AverageProfit, ASC, ProfitReRate, Lot_SC, LAN_SC, LSA, Amazon_P, eBayFS, Buy, Offer, Bid, Lot1_Amazon, Lot2_Amazon, Lot3_Amazon, Lot4_Amazon, Commission, Lot1_Ebay, Lot2_Ebay, Lot3_Ebay, Lot4_Ebay', 'numerical'),
            array('ProductModel, ProductName, PModel_2, ECategory, CCategory, ESCategory, CSCategory', 'length', 'max' => 100),
            array('ProductDetail, Packing, Comment, Lot_Cmnts, Description, Listing_Des', 'length', 'max' => 1073741823),
            array('VendorCode, CreateTime, UpdateTime, Login, Modifier', 'length', 'max' => 255),
            array('Inventory, Specialty, SizeInch, Sizecm, WeightLB, WeightKG, WeighttoCust, Type, Div, SubDiv, NIDNo, Class, Rank, NIP_Photo, NIP_Desc, NIP_Keyword, NIP_InstructionManu, NIP_Software, Package, Lot_Ready, Listing_Ready', 'length', 'max' => 20),
            array('Currency, Holiday, Event, Promotion, Lot, QStatus, Purchased, RCMDPerson, OF1, OF2', 'length', 'max' => 50),
            array('Flup_P', 'length', 'max' => 200),
            array('DelTime', 'safe'),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('prodid, ProductModel, ProductName, ProductDetail, VendorCode, Inventory, Specialty, SizeInch, Sizecm, WeightLB, WeightKG, WeighttoCust, FactoryCost, LACost, Packing, PurchaseTotal, SalesTotal, DamagedTotal, AverageCost, OnHand, ReorderPoint, Comment, CreateTime, UpdateTime, Login, Modifier, LAAvgCost, PModel_2, UsedTotal, OnHold, Available, ShipTotal, LentTotal, Currency, ECategory, CCategory, ESCategory, CSCategory, Type, Div, SubDiv, NIDNo, Amazon_S, Ebay_S, Class, Rank, OnShipping, TurnaroundTime, TurTimeCoefficient, Re_weekNo, Qu_Day, Qu_3Days, Qu_Current, Qu_4Weeks, Qu_12Weeks, Qu_Past, Re_pieceNo, OHWeekNo, Ivnt_Value, ExceedingNo, Eprofit, AverageProfit, ASC, ProfitReRate, SalesWeek, LAN, Lot_SC, LAN_SC, LSA, Lot_Cmnts, NIP_Photo, NIP_Desc, NIP_Keyword, NIP_InstructionManu, NIP_Software, Package, Holiday, Event, Promotion, ListingNo, Lot_Ready, Listing_Ready, Description, Amazon_P, eBayFS, Buy, Offer, Bid, Lot, Lot1_Amazon, Lot2_Amazon, Lot3_Amazon, Lot4_Amazon, Commission, QStatus, Purchased, Listing_Des, RCMDPerson, Lot1_Ebay, Lot2_Ebay, Lot3_Ebay, Lot4_Ebay, Flup_P, OF1, OF2, ProductID, DelTime', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'prodid' => 'Prodid',
            'ProductModel' => 'Product Model',
            'ProductName' => 'Product Name',
            'ProductDetail' => 'Product Detail',
            'VendorCode' => 'Vendor Code',
            'Inventory' => 'Inventory',
            'Specialty' => 'Specialty',
            'SizeInch' => 'Size Inch',
            'Sizecm' => 'Sizecm',
            'WeightLB' => 'Weight Lb',
            'WeightKG' => 'Weight Kg',
            'WeighttoCust' => 'Weightto Cust',
            'FactoryCost' => 'Factory Cost',
            'LACost' => 'Lacost',
            'Packing' => 'Packing',
            'PurchaseTotal' => 'Purchase Total',
            'SalesTotal' => 'Sales Total',
            'DamagedTotal' => 'Damaged Total',
            'AverageCost' => 'Average Cost',
            'OnHand' => 'On Hand',
            'ReorderPoint' => 'Reorder Point',
            'Comment' => 'Comment',
            'CreateTime' => 'Create Time',
            'UpdateTime' => 'Update Time',
            'Login' => 'Login',
            'Modifier' => 'Modifier',
            'LAAvgCost' => 'Laavg Cost',
            'PModel_2' => 'Pmodel 2',
            'UsedTotal' => 'Used Total',
            'OnHold' => 'On Hold',
            'Available' => 'Available',
            'ShipTotal' => 'Ship Total',
            'LentTotal' => 'Lent Total',
            'Currency' => 'Currency',
            'ECategory' => 'Ecategory',
            'CCategory' => 'Ccategory',
            'ESCategory' => 'Escategory',
            'CSCategory' => 'Cscategory',
            'Type' => 'Type',
            'Div' => 'Div',
            'SubDiv' => 'Sub Div',
            'NIDNo' => 'Nidno',
            'Amazon_S' => 'Amazon S',
            'Ebay_S' => 'Ebay S',
            'Class' => 'Class',
            'Rank' => 'Rank',
            'OnShipping' => 'On Shipping',
            'TurnaroundTime' => 'Turnaround Time',
            'TurTimeCoefficient' => 'Tur Time Coefficient',
            'Re_weekNo' => 'Re Week No',
            'Qu_Day' => 'Qu Day',
            'Qu_3Days' => 'Qu 3 Days',
            'Qu_Current' => 'Qu Current',
            'Qu_4Weeks' => 'Qu 4 Weeks',
            'Qu_12Weeks' => 'Qu 12 Weeks',
            'Qu_Past' => 'Qu Past',
            'Re_pieceNo' => 'Re Piece No',
            'OHWeekNo' => 'Ohweek No',
            'Ivnt_Value' => 'Ivnt Value',
            'ExceedingNo' => 'Exceeding No',
            'Eprofit' => 'Eprofit',
            'AverageProfit' => 'Average Profit',
            'ASC' => 'Asc',
            'ProfitReRate' => 'Profit Re Rate',
            'SalesWeek' => 'Sales Week',
            'LAN' => 'Lan',
            'Lot_SC' => 'Lot Sc',
            'LAN_SC' => 'Lan Sc',
            'LSA' => 'Lsa',
            'Lot_Cmnts' => 'Lot Cmnts',
            'NIP_Photo' => 'Nip Photo',
            'NIP_Desc' => 'Nip Desc',
            'NIP_Keyword' => 'Nip Keyword',
            'NIP_InstructionManu' => 'Nip Instruction Manu',
            'NIP_Software' => 'Nip Software',
            'Package' => 'Package',
            'Holiday' => 'Holiday',
            'Event' => 'Event',
            'Promotion' => 'Promotion',
            'ListingNo' => 'Listing No',
            'Lot_Ready' => 'Lot Ready',
            'Listing_Ready' => 'Listing Ready',
            'Description' => 'Description',
            'Amazon_P' => 'Amazon P',
            'eBayFS' => 'E Bay Fs',
            'Buy' => 'Buy',
            'Offer' => 'Offer',
            'Bid' => 'Bid',
            'Lot' => 'Lot',
            'Lot1_Amazon' => 'Lot1 Amazon',
            'Lot2_Amazon' => 'Lot2 Amazon',
            'Lot3_Amazon' => 'Lot3 Amazon',
            'Lot4_Amazon' => 'Lot4 Amazon',
            'Commission' => 'Commission',
            'QStatus' => 'Qstatus',
            'Purchased' => 'Purchased',
            'Listing_Des' => 'Listing Des',
            'RCMDPerson' => 'Rcmdperson',
            'Lot1_Ebay' => 'Lot1 Ebay',
            'Lot2_Ebay' => 'Lot2 Ebay',
            'Lot3_Ebay' => 'Lot3 Ebay',
            'Lot4_Ebay' => 'Lot4 Ebay',
            'Flup_P' => 'Flup P',
            'OF1' => 'Of1',
            'OF2' => 'Of2',
            'ProductID' => 'Product',
            'DelTime' => 'Del Time',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search() {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria = new CDbCriteria;

        $criteria->compare('prodid', $this->prodid);
        $criteria->compare('ProductModel', $this->ProductModel, true);
        $criteria->compare('ProductName', $this->ProductName, true);
        $criteria->compare('ProductDetail', $this->ProductDetail, true);
        $criteria->compare('VendorCode', $this->VendorCode, true);
        $criteria->compare('Inventory', $this->Inventory, true);
        $criteria->compare('Specialty', $this->Specialty, true);
        $criteria->compare('SizeInch', $this->SizeInch, true);
        $criteria->compare('Sizecm', $this->Sizecm, true);
        $criteria->compare('WeightLB', $this->WeightLB, true);
        $criteria->compare('WeightKG', $this->WeightKG, true);
        $criteria->compare('WeighttoCust', $this->WeighttoCust, true);
        $criteria->compare('FactoryCost', $this->FactoryCost);
        $criteria->compare('LACost', $this->LACost);
        $criteria->compare('Packing', $this->Packing, true);
        $criteria->compare('PurchaseTotal', $this->PurchaseTotal);
        $criteria->compare('SalesTotal', $this->SalesTotal);
        $criteria->compare('DamagedTotal', $this->DamagedTotal);
        $criteria->compare('AverageCost', $this->AverageCost);
        $criteria->compare('OnHand', $this->OnHand);
        $criteria->compare('ReorderPoint', $this->ReorderPoint);
        $criteria->compare('Comment', $this->Comment, true);
        $criteria->compare('CreateTime', $this->CreateTime, true);
        $criteria->compare('UpdateTime', $this->UpdateTime, true);
        $criteria->compare('Login', $this->Login, true);
        $criteria->compare('Modifier', $this->Modifier, true);
        $criteria->compare('LAAvgCost', $this->LAAvgCost);
        $criteria->compare('PModel_2', $this->PModel_2, true);
        $criteria->compare('UsedTotal', $this->UsedTotal);
        $criteria->compare('OnHold', $this->OnHold);
        $criteria->compare('Available', $this->Available);
        $criteria->compare('ShipTotal', $this->ShipTotal);
        $criteria->compare('LentTotal', $this->LentTotal);
        $criteria->compare('Currency', $this->Currency, true);
        $criteria->compare('ECategory', $this->ECategory, true);
        $criteria->compare('CCategory', $this->CCategory, true);
        $criteria->compare('ESCategory', $this->ESCategory, true);
        $criteria->compare('CSCategory', $this->CSCategory, true);
        $criteria->compare('Type', $this->Type, true);
        $criteria->compare('Div', $this->Div, true);
        $criteria->compare('SubDiv', $this->SubDiv, true);
        $criteria->compare('NIDNo', $this->NIDNo, true);
        $criteria->compare('Amazon_S', $this->Amazon_S);
        $criteria->compare('Ebay_S', $this->Ebay_S);
        $criteria->compare('Class', $this->Class, true);
        $criteria->compare('Rank', $this->Rank, true);
        $criteria->compare('OnShipping', $this->OnShipping);
        $criteria->compare('TurnaroundTime', $this->TurnaroundTime);
        $criteria->compare('TurTimeCoefficient', $this->TurTimeCoefficient);
        $criteria->compare('Re_weekNo', $this->Re_weekNo);
        $criteria->compare('Qu_Day', $this->Qu_Day);
        $criteria->compare('Qu_3Days', $this->Qu_3Days);
        $criteria->compare('Qu_Current', $this->Qu_Current);
        $criteria->compare('Qu_4Weeks', $this->Qu_4Weeks);
        $criteria->compare('Qu_12Weeks', $this->Qu_12Weeks);
        $criteria->compare('Qu_Past', $this->Qu_Past);
        $criteria->compare('Re_pieceNo', $this->Re_pieceNo);
        $criteria->compare('OHWeekNo', $this->OHWeekNo);
        $criteria->compare('Ivnt_Value', $this->Ivnt_Value);
        $criteria->compare('ExceedingNo', $this->ExceedingNo);
        $criteria->compare('Eprofit', $this->Eprofit);
        $criteria->compare('AverageProfit', $this->AverageProfit);
        $criteria->compare('ASC', $this->ASC);
        $criteria->compare('ProfitReRate', $this->ProfitReRate);
        $criteria->compare('SalesWeek', $this->SalesWeek);
        $criteria->compare('LAN', $this->LAN);
        $criteria->compare('Lot_SC', $this->Lot_SC);
        $criteria->compare('LAN_SC', $this->LAN_SC);
        $criteria->compare('LSA', $this->LSA);
        $criteria->compare('Lot_Cmnts', $this->Lot_Cmnts, true);
        $criteria->compare('NIP_Photo', $this->NIP_Photo, true);
        $criteria->compare('NIP_Desc', $this->NIP_Desc, true);
        $criteria->compare('NIP_Keyword', $this->NIP_Keyword, true);
        $criteria->compare('NIP_InstructionManu', $this->NIP_InstructionManu, true);
        $criteria->compare('NIP_Software', $this->NIP_Software, true);
        $criteria->compare('Package', $this->Package, true);
        $criteria->compare('Holiday', $this->Holiday, true);
        $criteria->compare('Event', $this->Event, true);
        $criteria->compare('Promotion', $this->Promotion, true);
        $criteria->compare('ListingNo', $this->ListingNo);
        $criteria->compare('Lot_Ready', $this->Lot_Ready, true);
        $criteria->compare('Listing_Ready', $this->Listing_Ready, true);
        $criteria->compare('Description', $this->Description, true);
        $criteria->compare('Amazon_P', $this->Amazon_P);
        $criteria->compare('eBayFS', $this->eBayFS);
        $criteria->compare('Buy', $this->Buy);
        $criteria->compare('Offer', $this->Offer);
        $criteria->compare('Bid', $this->Bid);
        $criteria->compare('Lot', $this->Lot, true);
        $criteria->compare('Lot1_Amazon', $this->Lot1_Amazon);
        $criteria->compare('Lot2_Amazon', $this->Lot2_Amazon);
        $criteria->compare('Lot3_Amazon', $this->Lot3_Amazon);
        $criteria->compare('Lot4_Amazon', $this->Lot4_Amazon);
        $criteria->compare('Commission', $this->Commission);
        $criteria->compare('QStatus', $this->QStatus, true);
        $criteria->compare('Purchased', $this->Purchased, true);
        $criteria->compare('Listing_Des', $this->Listing_Des, true);
        $criteria->compare('RCMDPerson', $this->RCMDPerson, true);
        $criteria->compare('Lot1_Ebay', $this->Lot1_Ebay);
        $criteria->compare('Lot2_Ebay', $this->Lot2_Ebay);
        $criteria->compare('Lot3_Ebay', $this->Lot3_Ebay);
        $criteria->compare('Lot4_Ebay', $this->Lot4_Ebay);
        $criteria->compare('Flup_P', $this->Flup_P, true);
        $criteria->compare('OF1', $this->OF1, true);
        $criteria->compare('OF2', $this->OF2, true);
        $criteria->compare('ProductID', $this->ProductID);
        $criteria->compare('DelTime', $this->DelTime, true);

        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }
    
    protected function beforeSave() {        
        if (parent::beforeSave()) {
            if ($this->isNewRecord) {
                $this->DelTime = date('Y-m-d H:i:s');
            }            
        }
        return true;
    }

}